#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 2e5 + 10;
using ll = long long;
struct Node
{
    int l, r;
    ll v, add;
}tr[N * 4];
int n, m;
int w[N];
void pushdown(int u)
{
    auto& root = tr[u], & left = tr[u << 1], & right = tr[u << 1 | 1];
    if (root.add)
    {
        left.add += root.add;
        left.v += root.add;
        right.add += root.add;
        right.v += root.add;
        root.add = 0;
    }
}
void pushup(int u)
{
    tr[u].v = min(tr[u << 1].v, tr[u << 1 | 1].v);
}
void build(int u, int l, int r)
{
    if (l == r) tr[u] = { l,r,w[l],0 };
    else
    {
        tr[u] = { l,r };
        int mid = l + r >> 1;
        build(u << 1, l, mid);
        build(u << 1 | 1, mid + 1, r);
        pushup(u);
    }
}
void modify(int u, int l, int r, int v)
{
    if (tr[u].l >= l && tr[u].r <= r)
    {
        tr[u].v += v;
        tr[u].add += v;
    }
    else
    {
        pushdown(u);
        int mid = tr[u].l + tr[u].r >> 1;
        if (l <= mid) modify(u << 1, l, r, v);
        if (r > mid) modify(u << 1 | 1, l, r, v);
        pushup(u);
    }
}
ll query(int u, int l, int r)
{
    if (tr[u].l >= l && tr[u].r <= r) return tr[u].v;
    pushdown(u);
    int mid = tr[u].l + tr[u].r >> 1;
    ll v = 1e18;
    if (l <= mid) v = min(v, query(u << 1, l, r));
    if (r > mid) v = min(v, query(u << 1 | 1, l, r));
    return v;
}
int main()
{
    cin >> n;
    for (int i = 0; i < n; i++) cin >> w[i];
    build(1, 0, n - 1);
    cin >> m;
    while (m--)
    {
        int l, r;
        char c;
        scanf("%d %d%c", &l, &r, &c);
        if (c == '\n')
        {
            if (l <= r) cout << query(1, l, r) << endl;
            else cout << min(query(1, l, n - 1), query(1, 0, r)) << endl;
        }
        else
        {
            int v;
            scanf("%d", &v);
            if (l <= r) modify(1, l, r, v);
            else
            {
                modify(1, 0, r, v);
                modify(1, l, n - 1, v);
            }
        }
    }
    return 0;
}